    <!-- Timeline CSS -->
    <link href="<?php echo $baseurl.'public';?>/dist/css/timeline.css" rel="stylesheet">
    
    <!-- Flot Charts JavaScript -->
    <script src="<?php echo $baseurl?>public/bower_components/flot/excanvas.min.js"></script>
    <script src="<?php echo $baseurl?>public/bower_components/flot/jquery.flot.js"></script>
    <script src="<?php echo $baseurl?>public/bower_components/flot/jquery.flot.pie.js"></script>
    <script src="<?php echo $baseurl?>public/bower_components/flot/jquery.flot.resize.js"></script>
    <script src="<?php echo $baseurl?>public/bower_components/flot/jquery.flot.time.js"></script>
    <script src="<?php echo $baseurl?>public/bower_components/flot.tooltip/js/jquery.flot.tooltip.min.js"></script>
    
    <!-- Morris Charts JavaScript -->
    <script src="<?php echo $baseurl?>public/bower_components/raphael/raphael.js"></script>
    <script src="<?php echo $baseurl?>public/bower_components/morrisjs/morris.min.js"></script>
    
    <div class="row">
                <div class="col-lg-12">
                    <h1 class="page-header">Danh sách dự án</h1>
                </div>
                <!-- /.col-lg-12 -->
				<div class="col-lg-12">
                                <?php if($this->session->userdata("level") == 1) {?>
				<p class="lead"><a href="<?php echo site_url('add-project');?>"><button type="button" class="btn btn-success btn-circle btn-lg">
					<i class="fa fa-plus"></i>
				</button> Tạo dự án mới</a></p>
                                <?php } ?>
				</div>
				
            </div>
			
           
            <div class="row">
                <div class="col-lg-12">
                    
                    <!-- /.panel -->
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            <i class="fa fa-clock-o fa-fw"></i> Dự án gần đây
                        </div>
                        <!-- /.panel-heading -->
                        <div class="panel-body">
                            <ul class="timeline">
                               <?php $i = 0; foreach ( $data AS $el=>$le ){ ?> 
                                <li class="<?php if( $i % 2 == 1 ){ echo 'timeline-inverted'; } ?>">
                                    <div class="timeline-badge <?php echo $fview->U_getColor($le->status,$le->time_end);?>"><i class="fa <?php echo $setIconRand;?>"></i>
                                    </div>
                                    <div class="timeline-panel">
                                        <div class="timeline-heading">
                                            <h4 class="timeline-title"><?php if( $le->is_pin == 1 ){ ?><button type="button" class="btn btn-success btn-circle"><i class="fa fa-heart"></i>
										</button> <?php } ?><a href="<?php echo site_url('project-detail/'.$le->id);?>"><?php echo $le->project_name;?></a>
										<p style="margin-top: 10px;"><small class="text-muted"><i class="fa fa-clock-o"></i><?php echo ' Tạo lúc '.date('H:i d-m-Y',strtotime($le->created)).' bởi '.$le->fullname;?> </small>
                                            </p>
											</h4>
                                        </div>
                                        <div class="timeline-body">
											<i class="fa fa-info-circle"></i> Mô tả<br>
                                            <?php echo $le->content;?>										
											<p class="text-info"><i class="fa fa-link"></i> <a target="_blank" href="<?php echo $le->linkdocs;?>">Link google docs</a></p>
											<p class="text-info"><i class="fa fa-user"></i> Thực hiện <?php  $j=1;$k=count($le->user); foreach ( $le->user AS $el1=>$le1 ){ ?>
											<a href="<?php echo site_url('report-user')."?us=".$le1->id;?>"><?php echo $le1->fullname;?></a><?php if($j < $k) {?>  ,<?php }$j++;  ?> 
											<?php } ?> </p>
											<hr>
											<div>
												<p>
													<strong>Tiến độ công việc</strong>
													<span class="pull-right text-muted text-warning">Hoàn thành <?php echo $le->percent;?>% </span>
												</p>
												<div class="progress progress-striped active">
													<div class="progress-bar <?php echo $fview->U_getProgressBar((int)$le->percent);?>" role="progressbar" aria-valuenow="<?php echo $le->percent;?>" aria-valuemin="0" aria-valuemax="100" style="width: <?php echo $le->percent;?>%">
														<span class="sr-only"><?php echo $le->percent;?>% Complete (warning)</span>
													</div>
												</div>
											</div>
											<div>
												<p>
                                                                                                    <?php $timeUsed=round(((time()- strtotime($le->time_start))/(strtotime($le->time_end)-strtotime($le->time_start)))*100,0);
                                                                                                            if($timeUsed > 100 )$timeUsed = 100;
                                                                                                            if($timeUsed < 0)$timeUsed  = 0;
                                                                                                            ?>
													<strong>Tiến độ thời gian</strong>
													<span class="pull-right text-muted text-warning">Còn lại <?php echo 100-$timeUsed;?>% </span>
												</p>
												<div class="progress progress-striped active">
													<div class="progress-bar <?php echo $fview->U_getProgressBar((int)$timeUsed);?>" role="progressbar" aria-valuenow="<?php echo $timeUsed;?>" aria-valuemin="0" aria-valuemax="100" style="width: <?php echo $timeUsed;?>%">
														<span class="sr-only"><?php echo $timeUsed;?>% Complete (warning)</span>
													</div>
												</div>
												
												<span style="float: left;"><?php echo date('d-m-Y',strtotime($le->time_start));?></span>
												<span style="float: right;"><?php echo date('d-m-Y',strtotime($le->time_end));?></span>
												<div class="clear" style="clear: both">
												</div>
											</div>
											<hr>
                                            <div class="btn-group">
                                                <button type="button" class="btn btn-primary btn-sm dropdown-toggle" data-toggle="dropdown">
                                                    <i class="fa fa-gear"></i>  <span class="caret"></span>
                                                </button>
                                                <ul class="dropdown-menu" role="menu">
                                                    <li><a href="<?php echo site_url('project-detail/'.$le->id);?>"><button type="button" class="btn btn-success btn-circle"><i class="fa fa-link"></i>
                            </button> Xem chi tiết</a>
                                                    </li>
												<?php if( $this->session->userdata('level') == 1 ){ ?>
                                                    <li><a href="<?php echo site_url('edit-project/'.$le->id);?>"><button type="button" class="btn btn-primary btn-circle"><i class="fa fa-list"></i>
                            </button> Chỉnh sửa</a>
                                                    </li>
                                                    <li><a href="<?php echo site_url('project-pin/'.$le->id);?>"><?php if( $le->is_pin == 1 ){ echo '<button type="button" class="btn btn-info btn-circle"><i class="fa fa-check"></i>
                            </button> Bỏ đánh dấu là dự án nổi bật'; }else{ echo '<button type="button" class="btn btn-info btn-circle"><i class="fa fa-check"></i>
                            </button> Đánh dấu là dự án nổi bật';}?></a>
                                                    </li>
                                                    <li class="divider"></li>
                                                    <li style="cursor: pointer;" id="<?php echo $le->id;?>-<?php echo $le->active;?>" class="deactive-project"><a><button type="button" class="btn btn-warning btn-circle"><i class="fa fa-times"></i>
                            </button> <?php if( $le->active == 1 ){ echo 'Hủy kích hoạt dự án này';}else{ echo 'Kích hoạt dự án này';} ?></a>
                                                    </li>
												<?php } ?>
                                                </ul>
                                            </div>
                                        </div>
                                    </div>
                                    
                                    <div class="panel-chart">
                                        <div class="flot-chart">
                                            <div class="flot-chart-content" id="flot-pie-chart<?php echo $i;?>"></div>
                                        </div>
                                        <div class="chart min">
                                            <div class="morris-bar" id="morris-bar-chart<?php echo $i;?>"></div>
                                        </div>
                                    </div>
                                </li>
								
								
								
								
						<?php 
			$mrdata = '[';  
			foreach ( $le->user_rate AS $el5=>$le5 ){ 
				$mrdata .= "{y: '".$le5->fullname."',a: ".$le5->rate2."},";
			}
			$mrdata .= ']';
//                        var_dump($mrdata);
//                        if($i == 3 )$mrdata="[{y: 'Nhất',a: 37},{y: 'Tú',a: 67},{y: 'Tùng',a: 35},{y: 'Dung',a: 25},]";
//                        var_dump($mrdata);
		?>		
								<script>
        //Flot Pie Chart
        $(function() {
        
            var data = [{
                label: " Chưa hoàn thành",
                data: <?php echo (100 - $le->percent);?>
            }, {
                label: " Đã hoàn thành",
                data: <?php echo $le->percent;?>
            }];
        
            var plotObj = $.plot($("#flot-pie-chart<?php echo $i;?>"), data, {
                series: {
                    pie: {
                        show: true,
                        background: { opacity: 0.5,
                        color: '#000' }
                    }
                },
                grid: {
                    hoverable: true
                },
                tooltip: true,
                tooltipOpts: {
                    content: "%p.0% %s", // show percentages, rounding to 2 decimal places
                    shifts: {
                        x: 20,
                        y: 0
                    },
                    defaultTheme: true,
                }
            });
        
        });
		
        $(function() {
            Morris.Bar({
                element: 'morris-bar-chart<?php echo $i;?>',
                
				
				
				data: <?php echo $mrdata;?>,
                xkey: 'y',
                ykeys: 'a',
                ymax:100,
                labels: ['Tiến độ'],
                hideHover: 'auto',
                resize: true
            });
        });
        
    </script>
								
								
								
								
								
								
								
								
								
								
							<?php $i++; } ?>	
                            </ul>
                        </div>
                        <!-- /.panel-body -->
                    </div>
                    <!-- /.panel -->
                </div>
                <!-- /.col-lg-8 -->
               
            </div>

    <!-- Metis Menu Plugin JavaScript -->
    <script src="<?php echo $baseurl.'public';?>/bower_components/metisMenu/dist/metisMenu.min.js"></script>
    
    
    
    <style>
    
        .timeline > li > .panel-chart{
            float: right;
            position: relative;
            width: 46%;
            padding: 20px;
            border: 1px solid #d4d4d4;
            border-radius: 2px;
            -webkit-box-shadow: 0 1px 6px rgba(0,0,0,0.175);
            box-shadow: 0 1px 6px rgba(0,0,0,0.175);
        }
        
        .timeline > li.timeline-inverted > .panel-chart {
            float: left;
        }
        
        .timeline > li > .panel-chart .flot-chart,
        .timeline > li > .panel-chart .chart{
            width: 69%;
            margin: auto;
        }
        .timeline > li > .panel-chart .chart.min{
            width: 100%;
            height: 180px;
        }
        .timeline > li > .panel-chart .chart.min .morris-bar{
            height: 180px;
        }
    </style>

    <!-- Custom Theme JavaScript -->
    <script src="<?php echo $baseurl.'public';?>/dist/js/sb-admin-2.js"></script>
	
	<script>
		$('.deactive-project').click(function(){
			var sid = this.id;
			var id = sid.split('-')[0]; 
			var ac = sid.split('-')[1];
			if( ac == 1 ){
				var str = 'Bạn có chắc chắn hủy kích hoạt dự án này?';
			}
			if( ac == 0 ){
				var str = 'Bạn có chắc chắn bật kích hoạt dự án này?';
			}
			var r = confirm(str);
			if (r == true) {
				location.href = '<?php echo $baseurl;?>project-deactive/'+id+'/'+ac;
			}
		});
	</script>